package com.atguigu.customerdemo.service.impl;

import com.atguigu.customerdemo.bean.Customer;
import com.atguigu.customerdemo.mapper.CustomerMapper;
import com.atguigu.customerdemo.service.CustomerService;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * ClassName: CustomerServiceImpl
 * Package: com.atguigu.customerdemo.service.impl
 * Description:
 *
 * @Author ChenJun
 * @Create 2023/4/3 13:06
 * @Version 1.0
 */
@DS("mysql1109")
@Service
public class CustomerServiceImpl extends ServiceImpl<CustomerMapper,Customer> implements CustomerService {

    @Autowired
    private CustomerMapper customerMapper;

    // 通过用户
    @Override
    public String getCustomerByName(String name) {
        Customer customer = customerMapper.getCustomerByName(name);
        return customer.toString();
    }

    @Override
    public String getCustomerById(String id) {
        return "Customer: "+ id;
    }

    @Override
    public void insertNameWithAge(String name, String age) {
        customerMapper.insertNameWithAge(name,age);
    }


}
